<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>山东省第七次人口普查地图集</title>
  <script src="../lib/vue.js"></script>
  <!-- 引入样式 -->
  <link rel="stylesheet" href="../lib/element-ui.css" />
  <!-- 引入组件库 -->
  <script src="../lib/element-ui.js"></script>
  <script src="../lib/jquery-3.6.0.min.js"></script>
  <script src="../conf.js"></script>
  <style>
    .card {
      box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
      transition: 0.3s;
      width: 100%;
      border-radius: 5px;

    }

    .card:hover {
      box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.2);
    }

    img {
      border-radius: 5px 5px 0 0;
      /* border-width: 5px;
      border-color: black;
      border-style:solid; */
    }

    .container {
      padding: 2px 16px;
    }

    .mapcard {
      width: 49%;
      display: inline-block;
      padding: 20px 20px 20px 0px;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <div id="app" style="padding: 20px 80px ;">
    <div style="display:flex;padding-right: 20px;">
      <h1 style="flex-grow: 1;">选择模板</h1>
    </div>
    <div style="display: flex;flex-wrap:wrap;">
      <div class="mapcard" style="align-items: center;display:flex;justify-content:center;">
        <a :href="`thememap_editor.html`"><h1>空白模板</h1></a> 
      </div>
      <div class="mapcard" v-for="(thememap,idx) in thememaps">
        <div class="card">
          <a :href="`thememap_editor.html?id=${thememap.id}`">
            <img :src="`http://${$ipapi}/img/prv/thememap_${thememap.id}.png`" style="width:100%;height:300px;" alt="">
          </a>
          <div class="container" style="text-align: center;">
            <h4><b>{{thememap.name}}</b></h4>
            <a :href="`thememap_editor.html?id=${thememap.id}&edittemplate=1`">修改模板
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
<script type="module">
  // let thememaps = await $.getJSON(`themetemplates.json`)
  Vue.prototype.$ipapi = ipapi;//统一设置页面上图片URL路径
  new Vue({
    el: '#app',
    mounted: async function () {
      this.thememaps = (await $.getJSON(`http://${ipapi}/thememaps`)).filter(f=>{
        console.log(f.template)
        return f.template=='1';
      })
    },
    data: function () {
      return {
        visible: false,
        thememaps:[]
      }
    }
  })
</script>

</html>